//
//  PeopleModel.m
//  OrgModel
//
//  Created by 王译 on 17/1/22.
//  Copyright © 2017年 王译. All rights reserved.
//

#import "PeopleModel.h"

@implementation PeopleModel

static NSMutableArray *sharedSingleton = nil;

+(NSMutableArray *)sharedSingleton{
    static  dispatch_once_t  onceToken;
    dispatch_once (&onceToken,^{
        sharedSingleton = [[NSMutableArray alloc]init];
    });
    return sharedSingleton;
}

+(NSArray *)searchWithCondition:(NSString *)condition{
    
    NSString *searchPre = [NSString stringWithFormat:@"userName LIKE '*%@*' || mobile LIKE '*%@*'",condition,condition];
    NSPredicate *predicate = [NSPredicate predicateWithFormat:searchPre];
    NSArray *arr = [[PeopleModel sharedSingleton]filteredArrayUsingPredicate:predicate];
    return arr;
}


@end
